#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

long long maxAlternatingSum(vector<int>& nums) {
    const int n = nums.size();
    long long even = nums[0],odd = 0;

    for(int i = 1; i < n; i ++){
        long long e = even,o = odd;
        even = max(e,o + nums[i]);
        odd = max(o,e - nums[i]);
    }
    return max(even,odd);
}

int main(){
    int a;
    vector<int> array;
    while(cin>>a){
        array.push_back(a);
        if(cin.get()=='\n')
            break;
    }
    cout << maxAlternatingSum(array) << endl;
    return 0;
}